/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.general.be;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.cip.esymons.colegiatura.be.ExperienciaLaboral;

/**
 *
 * @author FreddyHIQ
 */
@Entity
@Table(name = "gen_cargo")
@NamedQueries({@NamedQuery(name = "Cargo.findAll", query = "SELECT c FROM Cargo c"), @NamedQuery(name = "Cargo.findByCarCodigo", query = "SELECT c FROM Cargo c WHERE c.carCodigo = :carCodigo"), @NamedQuery(name = "Cargo.findByCarDescripcion", query = "SELECT c FROM Cargo c WHERE c.carDescripcion = :carDescripcion")})
public class Cargo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "car_codigo")
    private Integer carCodigo;
    @Basic(optional = false)
    @Column(name = "car_descripcion")
    private String carDescripcion;
    @Transient
    private boolean seleccionado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "carCodigo", fetch = FetchType.LAZY)
    private List<Directivos> directivosCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "carCodigo", fetch = FetchType.LAZY)
    private List<EstadoPersona> estadoPersonaCollection;
    @JoinColumn(name = "fk_are_codigo", referencedColumnName = "are_codigo")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Area fkAreCodigo;
    @OneToMany(mappedBy = "carCodigo", fetch = FetchType.LAZY)
    private List<ExperienciaLaboral> experienciaLaboralCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cargo", fetch = FetchType.LAZY)
    private List<CargoEmpleado> cargoEmpleadoCollection;

    public Cargo() {
    }

    public Cargo(Integer carCodigo) {
        this.carCodigo = carCodigo;
    }

    public Cargo(Integer carCodigo, String carDescripcion) {
        this.carCodigo = carCodigo;
        this.carDescripcion = carDescripcion;
    }

    public Integer getCarCodigo() {
        return carCodigo;
    }

    public void setCarCodigo(Integer carCodigo) {
        this.carCodigo = carCodigo;
    }

    public String getCarDescripcion() {
        return carDescripcion;
    }

    public void setCarDescripcion(String carDescripcion) {
        this.carDescripcion = carDescripcion;
    }

    public List<Directivos> getDirectivosCollection() {
        return directivosCollection;
    }

    public void setDirectivosCollection(List<Directivos> directivosCollection) {
        this.directivosCollection = directivosCollection;
    }

    public List<EstadoPersona> getEstadoPersonaCollection() {
        return estadoPersonaCollection;
    }

    public void setEstadoPersonaCollection(List<EstadoPersona> estadoPersonaCollection) {
        this.estadoPersonaCollection = estadoPersonaCollection;
    }

    public Area getFkAreCodigo() {
        return fkAreCodigo;
    }

    public void setFkAreCodigo(Area fkAreCodigo) {
        this.fkAreCodigo = fkAreCodigo;
    }

    public List<ExperienciaLaboral> getExperienciaLaboralCollection() {
        return experienciaLaboralCollection;
    }

    public void setExperienciaLaboralCollection(List<ExperienciaLaboral> experienciaLaboralCollection) {
        this.experienciaLaboralCollection = experienciaLaboralCollection;
    }

    public List<CargoEmpleado> getCargoEmpleadoCollection() {
        return cargoEmpleadoCollection;
    }

    public void setCargoEmpleadoCollection(List<CargoEmpleado> cargoEmpleadoCollection) {
        this.cargoEmpleadoCollection = cargoEmpleadoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (carCodigo != null ? carCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cargo)) {
            return false;
        }
        Cargo other = (Cargo) object;
        if ((this.carCodigo == null && other.carCodigo != null) || (this.carCodigo != null && !this.carCodigo.equals(other.carCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.general.be.Cargo[carCodigo=" + carCodigo + "]";
    }

    public boolean isSeleccionado() {
        return seleccionado;
    }

    public void setSeleccionado(boolean seleccionado) {
        this.seleccionado = seleccionado;
    }

}
